Conversation
- deploys efc and efc-web - includes notes and json to create db
Note: We still have an open ticket to make the mqtt public, currently it is a private ip. Additions: - manifest now includes step to create the service and binding to the efc app - created a Map for keys and values found if VCAP_SERVCIES mqtt exists - Added connection options to pass to the connect function to include username and password to the connection.
If using VCAP services connection, it will parse the ssl value and set the connection to ssl. For other applications the MQTT_BROKER_URL env variable will be used.
|
@mrcnc scheme is now pulled from the vcap. |
| "Map of keys and values from VCAP_SERVICES mqtt environment variable" | ||
| (or (some-> (System/getenv "VCAP_SERVICES") | ||
| (json/read-str :key-fn clojure.core/keyword) :p-rabbitmq first :credentials :protocols :mqtt) | ||
| {:username :username |
There was a problem hiding this comment.
So if there isn't a VCAP_SERVICES environment variable, we'll want to set default mqtt options. Therefore the values in this map should represent that, ex
{:host "localhost" :port 1883 :ssl false}
| (try | ||
| (do | ||
| (reset! conn (mh/connect url client-id)) | ||
| (reset! conn (mh/connect url client-id mqtt-connect-ops)) |
There was a problem hiding this comment.
Also, we should allow connections to brokers that don't require any credentials. So refactor this to set credentials if they exist, otherwise connect with (mh/connect url client-id)
| {:username (or (System/getenv "MQTT_USERNAME") (:username vcap_mqtt)) | ||
| :password (or (System/getenv "MQTT_PASSWORD") (:password vcap_mqtt))}) | ||
|
|
||
| (def vcap_tcp |
There was a problem hiding this comment.
Maybe rename this to mqtt-url?
|
|
||
| (def vcap_tcp | ||
| "When vcap_mqtt exists it returns a formated tcp connection" | ||
| (when (some? vcap_mqtt) |
There was a problem hiding this comment.
Seems like are trying to define the url to use so this should always return a string....so I would remove this line b/c vcap_mqtt should always return the defaults that you can use to build the mqtt url.
Status
IN DEVELOPMENT
JIRA Ticket
CAPI-241
Description
Todos
Note: We still have an open ticket to make the mqtt public, currently it is a private ip.
Steps to Test or Reproduce
Outline the steps to test or reproduce the PR here.
see manifest.yml